package com.yand.rabbitmq;


import com.yand.api.entity.mq.MyMessage;
import com.yand.api.entity.mq.syslog.SysLog;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.stereotype.Component;


/**
 * rabbitmq消息监听器类
 */
@Component
public class RabbitMqListener {

    @RabbitListener(queues = "testQueue")
    public void listenerMessage(MyMessage msg){
        System.out.println("Received <" + msg + ">");
        if(msg instanceof  SysLog){
            SysLog sysLog= (SysLog)msg;
            System.out.println(sysLog.getMessage() +":" + sysLog.getUserCode());
        }



    }

}
